<template>
    <div>
        <div class="top">
            <span @click="fun()">&lt;</span>
            <h1>新增服务地址</h1>
        </div>
        <div>
            <img src="../../../public/3.png" alt="">
        </div>
        <div  class="bot">
            <div class="sel">
                请输入服务地址&nbsp;>
            </div>
            <div class="main">
               <div>门牌号</div>
               <input type="text" v-model="inputa" placeholder="如3号楼4单元502">
            </div>
            <div class="main">
               <div>预约人</div>
               <input type="text" v-model="inputb">
            </div>
            <div class="main">
               <div>手机号</div>
               <input type="text" v-model="inputc">
            </div>
             <div class="main">
               <div>设置默认地址</div>
               <div class="moren">
<van-cell-group>
  <van-switch-cell v-model="checked" size="0.5rem" active-color="#cab394"/>
</van-cell-group>
               </div>
            </div>
        </div>
        <div class="tjiao" @click="funb()">
          保存
        </div>
    </div>
</template>

<script>
import {postdata} from "../../api/postapi.js"
export default {
  data() {
    return {
      checked: true,
      inputa:"",
      inputb:"",
      inputc:""
    };
  },
  methods:{
      fun(){
          this.$router.go(-1)
      },
      funb(){
      let usp=new URLSearchParams()
      usp.append("address",this.inputa)
      usp.append("aname",this.inputb)
      usp.append("tel",this.inputc)

      postdata("/api/addAddress",usp).then((ok)=>{
        console.log(ok);
      })
    }
  }
};
</script>

<style scoped>
.top {
  width: 100%;
  height: 0.9rem;
  display: flex;
  line-height: 0.9rem;
  position: fixed;
  background-color: #fff;
}
.top span {
  font-size: 0.5rem;
}
.top h1 {
  margin: auto;
}
img {
  width: 100%;
  height: 7rem;
  margin-top: 0.9rem;
}
.bot {
  width: 100%;
  border-radius: 0.2rem 0.2rem;
  overflow: hidden;
}
.bot .sel {
  width: 7rem;
  height: 0.7rem;
  background-color: #f9f7f4;
  border-radius: 0.2rem;
  margin: auto;
  margin-top: 0.2rem;
  text-align: center;
  line-height: 0.7rem;
  color: #cab394;
  font-size: 0.26rem;
}
.bot .main {
  width: 100%;
  height: 1rem;
  display: flex;
  justify-content: space-around;
  line-height: 1rem;
}
.bot .main input {
  width: 5rem;
  border: none;
  border-bottom: 0.01rem solid gainsboro;
  font-size: 0.26rem;
}
.bot .main div {
  font-size: 0.26rem;
  font-weight: 700;
}
.bot .main .moren{
    width: 5rem;
}
.tjiao{
  width: 80%;
  height: 1rem;
  background-color: red;
  margin: auto;
  border-radius: 0.5rem;
  text-align: center;
  line-height: 1rem;
  font-size: 0.32rem;
  font-weight: 700;
}
</style>
